﻿package
{
import flash.filters.GlowFilter;
import flash.text.*;

public class CustomTextField extends TextField
{
	private static var filter : GlowFilter = new GlowFilter(0xffffff, 0.7, 12, 12, 4)
	public function CustomTextField( a_text: String = "", a_color: uint = 0x000000, a_size: int = 28))
	{
		this.background = false
		this.backgroundColor = 0xffffff
		this.autoSize = TextFieldAutoSize.LEFT;
		this.multiline = true
		this.selectable = false;
		this.embedFonts = true;
		this.defaultTextFormat = new TextFormat( null, a_size, a_color )
		this.text = a_text;
	}
	
	public function center(): void
	{
		var f: TextFormat = copyTextFormat();
		f.align = TextFormatAlign.CENTER;
		this.defaultTextFormat = f;
	}
	
	public function set leading( a_val: int ): void
	{
		var f: TextFormat = copyTextFormat();
		f.leading = a_val;
		this.defaultTextFormat = f;
	}
	
	private function copyTextFormat(): TextFormat
	{
		var f: TextFormat = this.defaultTextFormat;
		f = new TextFormat( f.font, f.size, f.color, f.bold, f.italic, f.underline,
			f.url, f.target, f.align, f.leftMargin, f.rightMargin, f.indent, f.leading );
		return f;
	}
}
	
}